<?php

include_once dirname(dirname(__FILE__)) . '/include/common.php';
$core = new core();
$category_id = isset($_POST["category_id"]) ? intval($_POST["category_id"]) : 0;
$category = $core->getCategoryId($category_id);
if ($category) {
    $html = '';
    $html_select = $core->show_select_category($category_id);
    for ($i = count($html_select) - 1; $i >= 0; $i--) {
        $html.= $html_select[$i];
    }
    echo json_encode(array('type' => 0, 'category_id' => $category->category_id,
        'category_name' => $category->category_name,'show_select_category'=>$html, 'parent_category_id' => $category->category_parent));
    die;
} else {
    echo json_encode(array('type' => 1, 'msg' => "Category không tồn tại!"));
    die;
}
?>
